require "import"
require "str"

if activity.getSharedData("password")==nil then
toast("请先登录")
this.finish()
return
end

this.setContentView(loadlayout ({
  FrameLayout,
  --visibility=4,
  backgroundColor=背景色,
  --orientation="vertical",
  --elevation="2%w",
  paddingTop=状态栏高度,

  {
    FrameLayout,
    backgroundDrawable=上下渐变({背景色,深透,淡透}),
    layout_width="fill",
    layout_height="56dp" ,
    --gravity="center",
    padding="16dp",
    --backgroundColor=0xffffffff,
    elevation="2dp",
    paddingTop="8dp",
    paddingBottom="8dp",
    {
      ImageView,
      src="drawable/back.png",
      layout_height="fill",
      layout_width="44dp",
      foreground=波纹(波纹色),
      onClick=function ()
        this.finish()
      end,
      layout_gravity=20,
      padding="9dp",
      colorFilter=图标色,
    },
    {
      TextView,
      layout_width="fill",
      layout_height="fill",
      gravity="center",
      --layout_gravity="center",
      text="个性签名",
      textSize="20sp",
      textColor=文字色,
    },
  },
  {
      ScrollView,
      layout_height="-1";
      elevation=-2,
      layout_width="-1";
      {
        LinearLayout,
        layout_width="fill",
        orientation="vertical",
        paddingLeft="16dp",
      paddingRight="16dp",
      paddingTop="62dp",
      paddingBottom="96dp",
       {
       CardView,
       layout_width="fill",
       radius="4dp",
       backgroundColor=0x219e9e9e,
       elevation=0,
       {
       EditText,
       layout_width="fill",
       hint="在这里输入个性签名",
       textSize="16sp",
       text=activity.getSharedData("cloud_note")||"",
       textColor=文字色,
       id="note",
       padding="12dp",
       backgroundColor=0,
       },
       },
        
     };
   },
   {
        LinearLayout,
        layout_gravity="bottom",
        layout_width="fill",
        backgroundDrawable=上下渐变({1,背景色,背景色}),
   {
   TextView,
   text="保存",
   layout_height="56dp" ,
   foreground=波纹(波纹色),
   onClick=function()
   修改云笔记(activity.getSharedData("username"),activity.getSharedData("password"),note.text, function (返回值)
    if 返回值=="401" then
        toast("出现异常！")
       else
        data=cjson.decode(返回值)
        if data["code"]=="1" then
          toast("已保存")
          activity.setSharedData("cloud_note",note.text)
          else
          toast("出现异常！")
        end
      end
   end)
   end,
   textColor=文字色,
   layout_width="fill",
   layout_margin="16dp",
   gravity="center",
   padding="12dp",
   backgroundDrawable=圆角(nil,0x219e9e9e,{4,4,4,4,4,4,4,4}),
   },
   },
}))

登录账号(t1url,t1key,activity.getSharedData("username"),activity.getSharedData("password"),"",t1httk,function(返回值)
      if 返回值=="401" then
        toast("出现异常！")
       else
        data=cjson.decode(返回值)
        if data["code"]=="1" then
          note.setText(data.custom)
          else
          toast("出现异常！")
        end
      end
    end)